﻿using Microsoft.VisualStudio.TeamArchitect.PowerTools.Ultimate.Features;

namespace YasharEl.Infrastructure.ArchitectureTools.AppModeler
{
	public partial class ProcessWorkflow : GuidanceWorkflow
	{
		protected override void OnInitialize()
		{
			base.OnInitialize();
			this.Name = "GuidanceWorkflow";

			var initial = new Initial
			{
				Name = "Initial1",
			};
			var guidanceAction0 = new GuidanceAction
			{
				Name = "Overview",
				Link = "content://./Content/ProcessGuidance/Overview.mht",
				Postconditions =
				{
					new ConditionBinding(
						this.FeatureComposition, 
						"Microsoft.VisualStudio.TeamArchitect.PowerTools.Ultimate.Features.Library.Conditions.SetActionState",
						new FixedValuePropertyBinding("ActionState", "Enabled")),
				},
			};
			var guidanceAction1 = new GuidanceAction
			{
				Name = "Prepare Development Solution",
				Link = "content://./Content/ProcessGuidance/PrepareDevelopmentSolution.mht",
				Postconditions =
				{
					new ConditionBinding(
						this.FeatureComposition, 
						"Microsoft.VisualStudio.TeamArchitect.PowerTools.Ultimate.Features.Library.Conditions.SetActionState",
						new FixedValuePropertyBinding("ActionState", "Enabled")),
					new ConditionBinding(
						this.FeatureComposition, 
						"Microsoft.VisualStudio.TeamArchitect.PowerTools.Ultimate.Features.Library.Conditions.BlackboardInstanceValueIs",
						new FixedValuePropertyBinding("Key", "SolutionFoldersCreated"),
						new FixedValuePropertyBinding("Value", "True")),
					new ConditionBinding(
						this.FeatureComposition, 
						"Microsoft.VisualStudio.TeamArchitect.PowerTools.Ultimate.Features.Library.Conditions.BlackboardInstanceValueIs",
						new FixedValuePropertyBinding("Key", "ServiceFactoryProjectMappingFileCreated"),
						new FixedValuePropertyBinding("Value", "True")),
				},
			};
			guidanceAction1.Postconditions.Add(new UserAcceptanceBinding(guidanceAction1));
			var guidanceAction2 = new GuidanceAction
			{
				Name = "Create Testing Solution",
			};
			var guidanceAction3 = new GuidanceAction
			{
				Name = "Create Deployment Solution",
			};
			var guidanceAction4 = new GuidanceAction
			{
				Name = "Do something",
			};
			var guidanceAction5 = new GuidanceAction
			{
				Name = "Do something 2",
			};
			var guidanceAction6 = new GuidanceAction
			{
				Name = "Service Factory",
			};
			guidanceAction6.Postconditions.Add(new UserAcceptanceBinding(guidanceAction6));
			var guidanceAction7 = new GuidanceAction
			{
				Name = "Core Model",
			};
			guidanceAction7.Postconditions.Add(new UserAcceptanceBinding(guidanceAction7));
			var fork0 = new Fork
			{
				Name = "Scenarios",
				Link = "content://./Content/ProcessGuidance/Scenarios.mht",
			};
			var fork1 = new Fork
			{
				Name = "Reusable Architecture ",
				Link = "content://./Content/ProcessGuidance/ReusableArchitecture.mht",
			};
			var fork2 = new Fork
			{
				Name = "Existing System",
				Link = "content://./Content/ProcessGuidance/ExistingSystem.mht",
			};
			var fork3 = new Fork
			{
				Name = "New System",
				Link = "content://./Content/ProcessGuidance/NewSystem.mht",
			};
			var join0 = new Join
			{
				Name = "Join1",
			};
			var join1 = new Join
			{
				Name = "Join2",
			};
			var join2 = new Join
			{
				Name = "Join21",
			};
			var join3 = new Join
			{
				Name = "Join211",
			};
			var final0 = new Final
			{
				Name = "ActivityFinal1",
			};

			this.ConnectTo(initial);
			initial.ConnectTo(guidanceAction0);
			guidanceAction0.ConnectTo(fork0);
			guidanceAction1.ConnectTo(guidanceAction6);
			guidanceAction2.ConnectTo(join1);
			guidanceAction3.ConnectTo(join1);
			guidanceAction4.ConnectTo(join2);
			guidanceAction5.ConnectTo(join3);
			guidanceAction6.ConnectTo(guidanceAction7);
			guidanceAction7.ConnectTo(join1);
			fork0.ConnectTo(fork3);
			fork0.ConnectTo(fork1);
			fork0.ConnectTo(fork2);
			fork1.ConnectTo(guidanceAction4);
			fork2.ConnectTo(guidanceAction5);
			fork3.ConnectTo(guidanceAction1);
			fork3.ConnectTo(guidanceAction2);
			fork3.ConnectTo(guidanceAction3);
			join0.ConnectTo(final0);
			join1.ConnectTo(join0);
			join2.ConnectTo(join0);
			join3.ConnectTo(join0);

			this.OnPostInitialize();
		}

		partial void OnPostInitialize();
	}
}
